package com.examination.system.administrato;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

class myThread implements Callable<String>{

    @Override
    public String call() throws Exception {
        return "I call printf";
    }
}
/**
 * @author 寇淇芮
 * @Date 2019/10/14 11:10
 */
public class CallableDemo {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        FutureTask<String> futureTask = new FutureTask<String>(new myThread());
        new Thread(futureTask,"a").start();
        String o = futureTask.get();
        System.out.println(o);
    }
}
